const path = require('path');
const webpack = require('webpack');

const vendors = [
	'react',
	'react-dom',
	'redux',
	'react-redux',
	'react-router',
	'redux-thunk',
	"react-router-redux",
	'weui',
	'react-weui',
	'whatwg-fetch',
	'babel-polyfill'
];

module.exports = {
  output: {
    path: __dirname + "/build",
    filename: '[name].[chunkhash].js',
    library: '[name]_[chunkhash]',
  },
  entry: {
    vendor: vendors,
  },
  module: {
  	loaders: [
  		{
        test: /\.css$/,
        loader: 'style!css'
      }
  	]
  },
  plugins: [
    new webpack.optimize.DedupePlugin({
      output: {
        comments: false,

      },
      compress: {
        warnings: false
      }
    }),
    new webpack.DefinePlugin({
      'process.env': {
          NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.DllPlugin({
      path: path.join(__dirname, 'build', '[name]-manifest.json'),
      name: '[name]_[chunkhash]',
      context: __dirname,
    }),
  ],
};

